package com.algorithms.techniques.graph;

public class MyEdge<T extends Double> implements EdgeCompare<T> {
	private T capacity; // should be private
	private T weight; // should be private for good practice
	int id;

	public MyEdge(T weight, T capacity) {
		// this.id = edgeCount++; // This is defined in the outer class.
		this.weight = weight;
		this.capacity = capacity;
	}

	public String toString() { // Always good for debugging
		return "weight="+this.weight;

	}

	public T getCapacity() {
		return capacity;
	}

	public T getWeight() {
		return weight;
	}

	public int getId() {
		return id;
	}

	public void setCapacity(T iWeight) {
		weight = iWeight;

	}

	public void setWeight(T iCapacity) {

		capacity = iCapacity;
	}

	public int compareTo(EdgeCompare edge) {
		// TODO Auto-generated method stub
		if (this.weight.doubleValue() - edge.getWeight().doubleValue() > 0)
			return 1;
		if (this.weight.doubleValue() - edge.getWeight().doubleValue() < 0)
			return -1;
		return 0;
	}

	@Override
	public Object clone() throws CloneNotSupportedException
	{
		MyEdge<T> edge = new MyEdge<T>(this.weight,this.capacity);
		return edge;
	}

}
